﻿using AutoMapper;
using MediatR;
using S.Breeding.Domain;
using S.Breeding.Infrastructure;
using S.Breeding.Read.Api.Application.Command.ConditionMeasureCommand;

namespace S.Breeding.Read.Api.Application.CommandHandlers.ConditionMeasureHandlers
{
    public class ConditionMeasureEditCommandHandlers : IRequestHandler<ConditionMeasureEditCommand, ConditionMeasure>
    {
        private readonly IRepository<ConditionMeasure> repository;
        private readonly IMapper mapper;
        public ConditionMeasureEditCommandHandlers(IRepository<ConditionMeasure> repository, IMapper mapper)
        {
            this.repository = repository;
            this.mapper = mapper;
        }

        public async Task<ConditionMeasure> Handle(ConditionMeasureEditCommand request, CancellationToken cancellationToken)
        {
            return await repository.GetAsync(request.CMID);
        }
    }
}
